package com.wchat.controller;

import com.wchat.service.SendVerifyCode;
import com.wchat.utils.ResultVoUtils;
import com.wchat.vo.ResultVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@Api(value = "用户发送验证码")
@RestController
@RequestMapping("/user")
public class SendVerifyCodeController {


    @Autowired
    private SendVerifyCode sendVerifyCode;


    @PostMapping("/sendVerifyCode")
    @ApiOperation(value="根据用手机获取验证码", notes="根据用户手机来获取验证码详细信息")
    public ResultVo sendVerifyCode(@RequestParam(value = "phoneNumber")String phoneNumber){
       int invaliableTIme = 60;
       sendVerifyCode.sendVerifyCodeAndSave(phoneNumber,invaliableTIme);
       return ResultVoUtils.success();
    }


}
